{% if languages %}
    <form id="language-select-form" method="post" action="{% url django.views.i18n.set_language %}">{% csrf_token %}
        <div class="language">
            {% for lang in languages %}
                <a href="#" langcode="{{ lang.code }}"
                   {% if lang.code == default %}class="cur"{% endif %}
                   onclick="cl(this);">{{ lang.name_local }}</a>
            {% endfor %}
        </div>
        <input type="hidden" name="language" id="language">
    </form>
    <script type="text/javascript">
        function cl(obj) {
            var code = $(obj).attr("langcode");
            $("#language").val(code);
            $("#language-select-form").submit();
        }
    </script>
{% endif %}